#!/usr/bin/env python3
import math
import types
from collections.abc import Iterable
import os # 导入os模块，模块的概念后面讲到
from functools import reduce
import functools

x=3.13
y = x
x = None
print(x,'\n',y)
print(x is y)
# print('a'<'b'=='b')

# lista = ['a','b',1,2.0,4]
# listb = [2,3]+[3,400]
# print(lista)
# print(listb)
# lista.append(200)
# print(lista)
# lista.extend(listb)
# print(lista)
# print(lista.index(200))
# print(lista.count(2))
# lista.pop();lista.pop();
# lista.reverse()
# print(lista)
# lista.sort()
# print(lista)

# x = 3
# y = 3
# print(x==y==3)
# print(x is y)
# print(.918)

# print(14//4)
# print(14/4)

# print('****')
# print('*')
# print('****')
# print('*  *')
# print('****')

# x = 2
# print(x**2,'\n',6*(x/7),'\n',6/(4+5*x))

# if(1==1):
#     print('aaaaaa')

# print('^^^*','\n','^**')
# print(math.sin(20))
# print(math.hypot(3,5))
# print(199**99)
# print(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)
# print(3*5/2+4*2)
# print(2**3)
# x = 3
# print(2*x**2-x+4)

# value = input("please input your names:")
# print(value, ..., sep='_!_',end="\n")

# print('a','b','c')
# print('a','b','c',sep=',')
# print('a','b','c',...,sep=';')
# print('a','b','c',end=',yes! hello\n')
# print('a','b','c')

# a = input("please input your names:")
# print(a)




# import string,random
# '''多行
# 注释1'''
# """多行
# 注释2"""
# #单行注释
# capta = ''
# words = ''.join((string.ascii_letters,string.digits,"$","_"))
# for i in range(10):
#     capta += random.choice(words)
# print(capta)
# print("test-hello----\
#     nihao\
#     可多次换行")

# class Screen(object):
#     def __init__(self):
#         self._width = 0
#         self._height = 0
#     @property
#     def width(self):
#         return self._width
#     @property
#     def height(self):
#         return self._height
#     @width.setter
#     def width(self,value):
#         if not isinstance(value,int):
#             raise ValueError('score must be an integer!')
#         if value<= 0:
#             raise ValueError('int must "大于零"')
#         self._width = value
#     @height.setter
#     def height(self,value):
#         if not isinstance(value,int):
#             raise ValueError('score must be an integer!')
#         if value<= 0:
#             raise ValueError('int must "大于零"')
#         self._height= value
#     @property
#     def resolution(self):
#         return self._height*self._width
# # 测试:
# s = Screen()
# s.width = 1024
# s.height = 768
# print('resolution =', s.resolution)
# if s.resolution == 786432:
#     print('测试通过!')
# else:
#     print('测试失败!')


# def fn():
#     pass
# print(type(fn)==types.FunctionType)
# print(type(abs)==types.BuiltinFunctionType)
# print(type(lambda x: x)==types.LambdaType)
# print(dir(abs))

# print(hasattr(abs, 'x')) # 有属性'x'吗？

# class Student(object):

#     def __init__(self,name,gender,score):
#         self.__name = name
#         self.__gender = gender
#         self.__score = score
        
#     def print_score(self):
#         print('%s: %s' % (self.__name, self.__score))
    
#     def get_name(self):
#         return self.__name

#     def get_score(self):
#         return self.__score
    
#     def get_gender(self):
#         return self.__gender
    
#     def set_gender(self,gender):
#         self.__gender = gender
    
#     def set_score(self, score):
#         if 0 <= score <= 100:
#             self.__score = score
#         else:
#             raise ValueError('bad score')

# bart = Student('Crown','man',180)
# print(bart.get_name())
# print(bart.get_score())
# bart.set_score(170)
# print(bart.get_score())
# print(bart._Student__name)
# print(bart._Student__score)
# print(bart._Student__gender)
# 测试:
# bart = Student('Bart', 'male',100)
# if bart.get_gender() != 'male':
#     print('测试失败1!')
# else:
#     bart.set_gender('female')
#     if bart.get_gender() != 'female':
#         print('测试失败2!')
#     else:
#         print('测试成功!')

# print(type(bart.get_gender()))




# int2 = functools.partial(int, base=2)
# print(int2('1010101'))
# int3 = functools.partial(int,base=36)
# print(int3('1010101'))

# def calc(*numbers):
#     sum = 0
#     for n in numbers:
#         sum = sum + n * n
#     return sum
# print(calc())
# print(calc(1,2))
# numbers = [1,2,3]
# print(calc(*numbers))


# def person(name, age, **kw):
#     print('name:', name, 'age:', age, 'other:', kw)

# a = person('aa',12,aa='aaaa')


# def f1(a, b, c=0, *args, **kw):
#     print('a =', a, 'b =', b, 'c =', c, 'args =', args, 'kw =', kw)

# def f2(a, b, c=0, *, d, **kw):
#     print('a =', a, 'b =', b, 'c =', c, 'd =', d, 'kw =', kw)

# a = f1(1,2)
# b = f1(1,2,c=4)
# c= f1(1,2,4)
# d=f1(1,2,8,'ccc','gg')
# e=f1(1, 2, 3, 'a', 'b', x=99)
# f=f2(1, 2, d=99, ext=None)



# def quadratic(a,b,c):
#     d = b**2-4*a*c
#     if a == 0:
#         print('这是个一元一次方程')
#     elif d < 0:
#         print('无解')
#     else:
#         x1 = (-b+math.sqrt(d))/(2*a)
#         x2 = (-b-math.sqrt(d))/(2*a)
#         return x1,x2
# print(quadratic(1,1,1))


# def move(x,y,step,angle=0):
#     nx = x + step * math.cos(angle)
#     ny = y - step * math.sin(angle)
#     return nx,ny

# r = move(100,100,60,math.pi/6)
# print(r)
# print(r[0])
# x,y = move(100,100,60,math.pi/6)
# print(x,y)


# sum = 0
# for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
#     sum = sum + x
# print(sum)


# L = ['Bart', 'Lisa', 'Adam']
# length = len(L)
# for num in L:
#     print('cccc,',num)
#     print('aaa%s' %num)
# while length>=0:
#     print(length)
#     print('hello,',L[length-1])
#     length = length-1


# print("测试中文输出是否正常！")
#name = input('请您输入姓名：')
#print('hello,',name)
# cc = int(name)
# if cc==1:
#     print('1=1')
# elif cc==2:
#     print('2=2')
# elif cc>3:
#     print('3!=3',cc)
# else:
#     print('ccccc')

# def fact(n):
#     if n==1:
#         return 1
#     return n * fact(n - 1)

# print(fact(100))

# def trimStr(str):
#     newStr = str[1:-1]
#     return newStr

# print(trimStr(" cc "))

# d = {'a': 1, 'b': 2, 'c': 3}
# for key in d:
#     print(key,":",d[key])
# for value in d.values():
#     print(value,":")
# for k,v in d.items():
#     print(k,":",v)

# for ch in 'abc':
#     print(ch)

# a = isinstance('abc', Iterable) # str是否可迭代
# b = isinstance([1,2,3], Iterable) # list是否可迭代
# c = isinstance(1.23, Iterable) # 整数是否可迭代
# print("a:",a,",b:",b,",c:",c)

# for i,val in enumerate(["a","c",1234,"d"]):
#     print("this ",i+1,"is value==",val)

# def findMinAndMax(L):
#     if len(L)==0:#空集的情况
#        return (None, None)#返回值
#     min = -1
#     max = -1
#     for val in L:
#         print('当前==',val)
#         if(min==-1):
#             min = val
#         if(max==-1):
#             max = val
#         if(min>val):
#             min = val
#         if(max<val):
#             max = val
#     return (min,max)

# cc = [7, 1, 3, 9, 5]
# print(findMinAndMax(cc))
# print(findMinAndMax([]))

# print([x * x for x in range(1, 11) if x % 2==0])

# print([d for d in os.listdir('C://')])

# d = {'x': 'A', 'y': 'B', 'z': 'C' }
# print([k + '=' + v for k, v in d.items()])

# print([a.lower() for a in d])
# print([a.upper() for a in d])

# L = ['Hello', 'World', 18, 'Apple', None]
# print([s.lower() if isinstance(s,str) else s for s in L])

# def fib(max):
#     n, a, b = 0, 0, 1
#     while n < max:
#         yield b
#         a, b = b, a + b
#         n = n + 1
#     return 'done'
# g = fib(10)
# while True:
#     try:
#         x = next(g)
#         print('g:',x)
#     except StopIteration as e:
#         print("Generator return value:",e.value)
#         break

# L =[10]
# def test():
#     while True:
#         # 拷贝 L，results 指向 L，防止补 0 对 results 产生影响
#         yield L[:]
#         # 新行多一个元素
#         L.append(0)
#         # 更新新行的每一个值，L[-1] = 0，即最后一个元素
#         L = [L[i] + L[i - 1] for i in range(len(L))]
#         for cc in L:
#             print( cc)
# print()

# def tsl(x):
#     return x * x
# # ls = [1,2,6,10]
# ls = range(10)
# print(ls)
# r=map(tsl,ls)
# print(list(r))

# def add(x,y):
#     return x+y
# ls = range(11)
# print(reduce(add,ls))

# L1 = ['adam', 'LISA', 'barT']
# def normalize(name):
    # i,str = 0,""
    # for s in name:
    #     if i==0:
    #         str +=s.upper()
    #     else:
    #         str += s.lower()
    #     i = i + 1
    # return str
    # return name.capitalize()#首字母大写
# L2 = list(map(normalize, L1))
# print(L2)

# def prod(L):
#     # return reduce(lambda x,y:x*y,L)
#     def jisuan(x,y):
#       return x * y
#     return reduce(jisuan,L)
# print('3 * 5 * 7 * 9 =', prod([3, 5, 7, 9]))

# print(sorted(['bob', 'about', 'Zoo', 'Credit'], key=str.lower, reverse=True))
# print(sorted(['bob', 'about', 'Zoo', 'Credit'], key=str.lower, reverse=False))

# L = [('Bob', 75), ('Adam', 92), ('Bart', 66), ('Lisa', 88)]
# def by_name(t):
#     return t[0]
# def by_score(t):
#     #默认排列顺序为从低到高t[1]， 要使其从高到低，将分数先取负数-t[1]即可
#     return -t[-1]

# L2 = sorted(L, key=by_name)
# print(L2)
# L2 = sorted(L, key=by_score)
# print(L2)

# def lazy_sum(*args):
#     def sum():
#         ax = 0
#         for n in args:
#             ax = ax + n
#         return ax
#     return sum

# f1 = lazy_sum(1, 3, 5, 7, 9)
# f2 = lazy_sum(1, 3, 5, 7, 9)
# print(f1==f2)
# print(f1()==f2())